package com.education.dao;

import com.education.pojo.Question;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface QuestionMapper {
    int deleteByPrimaryKey(Integer qId);

    int insert(Question record);

    int insertSelective(Question record);

    Question selectByPrimaryKey(Integer qId);

    int updateByPrimaryKeySelective(Question record);

    int updateByPrimaryKey(Question record);

    /**
     * (吴)根据试卷的Id查询数据库中对应试卷的题，将该数据吐到前台页面
     */
    List<Question> selectQuestionListPage(Integer tpId);

    /**
     * (吴)根据题目ID 查询正确答案
     */
    List<Question> selectQuestionAnswerList(Integer tpId);

    /**
     * (吴)根据用户回答错误题目的ID 查询试卷的Tpid
     */
    Integer selectUserErrorTpidList(Integer qId);


    /*
    根据用户TPID查询本试卷的QID，将查询到的QID用到错误库中去比对，是否有该错题，有就显示
     */
    List<Integer> selectQidUseUserErrorQidList(Integer tpId);
/*
错题展示题，根据用户错误题的qid查询表中q_id, q_name, q_order, q_answer，q_answer_true等字段
 */
    Question selectUserErrorQuestionListMessage(Integer qId);


    /*
    林心晨
     */
    Integer selectByTotal ();

    Integer selectByToday(@Param("yesterday") Date yesterday , @Param("today") Date today);

    Integer selectByWeek(@Param("monday") Date monday ,@Param("sunday") Date sunday);

    Integer selectByMonth(@Param("firstDay") Date firstDay ,@Param("lastDay") Date lastDay);
}